package cn.reinforce.util.express.model.sf;

/**
 * 用于阿里云产品的操作，单例模式
 *
 * @author Fate
 * @date 2017/3/20
 */
public enum SF {
    INSTANCE;

    public static final String DEV_SERVICE_URL = "https://sfapi-sbox.sf-express.com/std/service";

    public static final String PRO_SERVICE_URL = "https://bspgw.sf-express.com/std/service";

    public static final String DEV_OAUTH2_URL = "https://sfapi-sbox.sf-express.com/oauth2/accessToken";

    public static final String PRO_OAUTH2_URL = "https://bspgw.sf-express.com/oauth2/accessToken";

    private String partnerId;
    private String key;

    private String templateId;

    private String serviceUrl;

    private String oauth2Url;


    public String getPartnerId() {
        return partnerId;
    }

    public String getKey() {
        return key;
    }

    public String getTemplateId() {
        return templateId;
    }

    public String getServiceUrl() {
        return serviceUrl;
    }

    public String getOauth2Url() {
        return oauth2Url;
    }

    public void init(String partnerId, String key, String templateId, boolean isPro) {
        this.partnerId = partnerId;
        this.key = key;
        this.templateId = templateId;
        this.serviceUrl = isPro ? PRO_SERVICE_URL : DEV_SERVICE_URL;
        this.oauth2Url = isPro ? PRO_OAUTH2_URL : DEV_OAUTH2_URL;
    }

}
